//
//  ZGSLeadViewController.m
//  Tour
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ZGSLeadViewController.h"
#import "AdvanceEdit.h"
#import "AppDelegate.h"
@interface ZGSLeadViewController ()<UIScrollViewDelegate>
@property (nonatomic, retain)UIScrollView *upScroll;
@property (nonatomic, retain)UIImageView *firstImage;
@property (nonatomic, retain)UIImageView *secondImage;
@property (nonatomic, retain)UIImageView *thirdImage;



@end

@implementation ZGSLeadViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    UIScrollView *leadView = [UIScrollView alloc] initWithFrame:cgre
    self.upScroll = [[UIScrollView alloc] initWithFrame:self.view.frame];
    self.upScroll.contentSize = CGSizeMake(3 * WIDTH + 10, 0);
    self.upScroll.pagingEnabled = YES;
    self.upScroll.showsHorizontalScrollIndicator = NO;
    self.upScroll.bounces = NO;
    self.upScroll.delegate = self;
//    self.upScroll.contentOffset = CGPointMake(WIDTH, 0);
    [self.view addSubview:self.upScroll];
    self.firstImage = [[UIImageView alloc] init];
    self.firstImage.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.firstImage.image = [UIImage imageNamed:@"one.jpg"];
    [self.upScroll addSubview:self.firstImage];
    
    self.secondImage = [[UIImageView alloc] init];
    self.secondImage.frame = CGRectMake(WIDTH, 0, WIDTH, HEIGHT);
    self.secondImage.image = [UIImage imageNamed:@"two.jpeg"];
    [self.upScroll addSubview:self.secondImage];

    self.thirdImage = [[UIImageView alloc] init];
    self.thirdImage.frame = CGRectMake(WIDTH * 2, 0, WIDTH, HEIGHT);
    self.thirdImage.image = [UIImage imageNamed:@"three.jpg"];
    [self.upScroll addSubview:self.thirdImage];
//    CGFloat offsetX = self.upScroll.contentOffset.x;
    




//    self.scrollImage.userInteractionEnabled = YES;

}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGFloat offsetX = self.upScroll.contentOffset.x;
    if (offsetX > WIDTH * 2) {
    
        AppDelegate *appVC = (AppDelegate *)[[UIApplication sharedApplication]delegate];
        [[UIApplication sharedApplication].keyWindow setRootViewController:appVC.tab];
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
